package com.chengdu.third.service.Impl;

import com.chengdu.third.dao.IUserDao;
import com.chengdu.third.pojo.User;
import com.chengdu.third.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author jingbo
 * @create 2021--08--15  21:56
 */

@Service
public class IUserServiceImpl implements IUserService {

    @Autowired
    private IUserDao iUserDao;

    @Override
    public User getUserById(long id) {
        return iUserDao.getUserById(id);
    }

    @Override
    public User getUserByUsername(String username) {
        return iUserDao.getUserByUsername(username);
    }

    @Override
    public List<User> findAll() {
        return iUserDao.find();
    }

    @Override
    public void deleteByid(long id) {
         iUserDao.delete(id);
    }

    @Override
    public void updateByid(String username,String password,String phone,long id) {
        iUserDao.update(username,password,phone,id);
    }


    @Override
    public void adduser(User user) {
           iUserDao.add(user);
    }

    @Override
    public void addUser1(String username, String password, String phone) {
        iUserDao.addUser1(username,password,phone);
    }

    @Override
    public int login(String username, String password) {
        return iUserDao.login(username,password);
    }
}
